Package-level declarations

This package contains components that relate to the connected GoPro including methods to operate on it.

All objects here should be accessed as properties of a GoPro object returned from OgpSdk.getGoPro

Note that for all methods here, the return value will always be wrapped in a Result.

Commands

Commands are accessed in a CommandsContainer via GoPro.commands.

For example, to print all files from the media list:

gopro.commands.getMediaList().onSuccess {
it.media.forEach { fileList ->
fileList.files.forEach { file ->
println(file.filename)
}
}
}

Settings

Settings are accessed in a SettingsContainer via GoPro.settings. Each setting has several methods of interaction as defined in Setting.

For example...

  • To print the current resolution

      gopro.settings.videoResolution.getValue().onSuccess { println(it.name) }
  • To print all currently available resolutions:

      gopro.settings.videoResolution.getCapabilities().onSuccess {
    it.forEach { resolution ->
    println(resolution.name)
    }
    }
  • To set the video resolution to a new value (assuming it is currently available):

      check(gopro.settings.videoResolution.setValue(VideoResolution.NUM_4K).isSuccess)
  • To register for, collect, and print resolution value updates as they asynchronously occur:

      gopro.settings.videoResolution.registerValueUpdates().onSuccess {
    it.collect { resolution ->
    println(resolution.name)
    }
    }
  • To register for, collect, and print resolution capability updates as they asynchronously occur:

      gopro.settings.videoResolution.registerCapabilityUpdates().onSuccess {
    it.collect { resolutions ->
    resolutions.forEach { resolution ->
    println(resolution.name)
    }
    }
    }

Statuses

Statuses are accessed in a StatusesContainer via GoPro.statuses. Each status has several methods of interaction as defined in Status.

For example...

  • To get the current battery level:

      gopro.statuses.internalBatteryPercentage.getValue().onSuccess { println(it) }
  • To register for, collect, and print battery value updates as they asynchronously occur:

      gopro.statuses.internalBatteryPercentage.registerValueUpdate().onSuccess {
    it.collect { batteryLevel ->
    println(batteryLevel)
    }
    }

Features

Features are higher layer abstractions of other API elements. They are accessed in a FeaturesContainer via GoPro.features

Here is a (naive) example of using the AccessPointFeature to connect the GoPro to a Wi-Fi access point:

with(gopro.features.accessPoint) {
// Get all available access opints and filter to find our target.
val entry = scanForAccessPoints().getOrThrow().first { it.ssid == "TARGET_SSID" }
// Start connecting to the access point..
connectAccessPoint(entry.ssid, "password").onSuccess {
// Wait to collect a finished element from the flow
it.first { state -> state.isFinished() }
}
}

Observation

Besides any of the flows returned from the various API elements above, there are several properties that can be observed as defined in IGpDescriptor.

For example...

  • To monitor disconnects:

      gopro.disconnects.collect { network ->
    println("The ${network.name} connection has dropped!")
    }
  • To wait until the camera is ready to perform an operation...

      gopro.isReady.first { it }

    Note that the GoPro object itself already monitors this and will suspend any requested operations until the camera is ready. That is, the user does not need to track this manually.

Types

Link copied to clipboard

Scan and connect the camera to an Access Point

Link copied to clipboard
class CameraInternalError(errorMessage: String) : Exception
Link copied to clipboard
class CohnFeature : KoinComponent

Camera-on-the-home-network (COHN) provisioning and querying

Link copied to clipboard

Wrapper to access operations exposed as methods.

Link copied to clipboard

Establish a Wi-Fi connection where the camera is an Access Point

Link copied to clipboard

Container used to access and exercise features

Link copied to clipboard

Top level interface to communicate with a connected GoPro.

Link copied to clipboard
interface IGpDescriptor

Properties of a connectd GoPro

Link copied to clipboard
class Setting<T : Enum<T>, IValuedEnum<*>>

A per-setting ID wrapper to perform all setting queries

Link copied to clipboard

Container used to access and operate on settings.

Link copied to clipboard
class Status<T : Any>

A per-status ID wrapper to perform all status queries

Link copied to clipboard

Container used to access and operate on statuses.